<?php
/**
 * 清理缓存
 *
 * @copyright  Copyright (c) 2015-2025 NcPHP Inc. (http://www.ncphp.com)
 * @license    http://www.ncphp.com
 * @link       http://www.ncphp.com
 * @since      File available since Release v1.1
 */
defined('InNcPHP') or exit('Access Invalid!');

class cacheControl extends SystemControl{
	public function __construct(){
		parent::__construct();
		Language::read('cache');
	}

	// 清理缓存
	public function clearOp(){
		$lang	= Language::getLangContent();

		if (chksubmit()){
			//清理所有缓存
			if($_POST['cls_full']==1){
				H('setting',true);
				H('area',true);
				H('category',true);
				H('store_rank',true);
				delCacheFile('fields');
		        showMessage($lang['cache_cls_ok']);exit;
			}

			//清理基本缓存
			if (@in_array('setting',$_POST['cache'])){
				H('setting',true);
			}

			//清理商品分类
			if (@in_array('category',$_POST['cache'])){
				H('category',true);
			}

			//清理TABLE缓存
			if (@in_array('table',$_POST['cache'])){
		        delCacheFile('fields');
			}

			//清理店铺等级
			if (@in_array('store_rank',$_POST['cache'])){
				H('store_rank',true);
			}
			
			$this->log(L('cache_cls_operate'));
			showMessage($lang['cache_cls_ok']);
		}

		Tpl::showpage('cache.clear');
	}
}
